const app = getApp()
Page({
    data: {
        user: {},
        medals: [],
        isCover: [],
        grade_own: 0,
        grade_all: 0,

    },
    onShow() {
        this.getMyData()
    },
    getMyData() {
        let user = app.globalData.user
        let medals = app.globalData.medals
        this.setData({
            user,
            medals,
        })

        let grade_all = this.data.medals.length
        let grade_own = user.medal.length
        let isCover = []
        for (let i = 0; i < grade_all; i++) {
            if (i < grade_own) {
                isCover.push(false)
            } else {
                isCover.push(true)
            }
        }
        this.setData({
            grade_own,
            grade_all,
            isCover,
        })
    },
});